/**
 * 
 */
package com.imarban.spring.dao;

import java.io.Serializable;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author imarban
 * 
 */
@Repository("genericDao")
@Scope(value = BeanDefinition.SCOPE_SINGLETON)
public class GenericDao {

	@Autowired
	private SessionFactory sessionFactory;

	@Transactional(rollbackFor = Exception.class)
	public Serializable save(Serializable entity) {
		return sessionFactory.getCurrentSession().save(entity);
	}

}
